package com.yanqu.road.entity.activity.deepfishing.config;

import com.yanqu.road.entity.activity.ActivityConfig;
import com.yanqu.road.utils.string.StringUtils;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Map;

public class DeepFishingConfig {

    private Map<Integer, DeepFishingFishConfig> fishConfigMap;

    private Map<Integer ,DeepFishingEquipConfig> equipConfigMap;

    private Map<Integer,DeepFishingEventConfig> eventConfigMap;

    private Map<Integer, List<DeepFishingBeachCombConfig>> beachCombConfig;

    //EXCHANGE_SCORE_ITEM_ID             积分道具id
    private int scoreItemId;
    //SEAFISHING_GANHAI_ITEM_ID         赶海夹道具id
    private int beachCombPowerItemId;
    //SEAFISHING_ENERGY_SCORE_NUM       钓鱼消耗一点体力获得积分
    private int fishingItemToScoreNum;
    //SEAFISHING_ENERGY_ITEM_ID             钓鱼体力道具id（桃花酥）
    private int fishingPowerItemId;
    //SEAFISHING_ENERGY_MAX_NUM             钓鱼体力上限
    private int fishingPowerMax;
    //SEAFISHING_ENERGY_RECOVERY_NUM        体力每次恢复数量
    private int fishingPowerPerTime;
    //SEAFISHING_ENERGY_RECOVERY_TIME       体力恢复需要时间(s)
    private int fishPowerRecoveryTime;
    //SEAFISHING_GANHAI_DAY_NUM         每天免费赶海次数
    private int dayFreeBeachCombTime;
    //SEAFISHING_FISHING_SPEED_DOWN     鱼钩初始下降速度
    private int fishingDownSpeed;
    //SEAFISHING_FISHING_SPEED_BEGIN    鱼钩初始移动速度
    private int fishingMoveSpeed;
    //SEAFISHING_FISHING_SPEED_UP_CUT   鱼钩上移速度削减(千分比)
    private int upDirectionSpeedCut;
    //SEAFISHING_FISHING_MAP_LONG       地图最大米数
    private int mapMaxDeep;
    //SEAFISHING_FISHING_MAP_OBJECT_NUM
    private List<DeepFishingObjectOcurRangeConfig> ocurRangeConfigs;
    //SEAFISHING_FISHING_MAP_OBJECT_SPACE
    private int objectSpace;
    //SEAFISHING_GANHAI_OPEN_TIME
    private int beachCombStartTime;     //赶海开始时间
    private int beachCombEndTime;       //赶海结束时间
    //SEAFISHING_GANHAI_FLASH_CD
    private int beachCombReflashCd;     //赶海刷新时间
    //SEAFISHING_GANHAI_OBJ_MAX_NUM         赶海每个场景的物品生成数
    private int beachCombMaxItemInMap;
    //SEAFISHING_GANHAI_HIGH_LIMIT
    private int minBeachCombHighQualityNum;         //最小生成的高品质数量
    private int maxBeachCombHighQualityNum;         //最大生成的高品质数量
    private int highQualityGoodThan;                //高品质至少要是
    //SEAFISHING_COIN_ITEM_ID
    private int coinItemId;                     //金币道具id
    //SEAFISHING_FISHING_QUICK_UNLOCK
    private int autoRodLevelNeed;
    //SEAFISHING_GANHAI_FIRST_REWARD
    private int firstBeachItem;
    //SEAFISHING_FISHING_PROTECT_1
    private int noCheckMeter;
    //SEAFISHING_FISHING_PROTECT_2
    private int speecCheckAdd;




    public DeepFishingConfig(Map<Integer, DeepFishingFishConfig> fishConfigMap, Map<Integer, DeepFishingEquipConfig> equipConfigMap,
                             Map<Integer, DeepFishingEventConfig> eventConfigMap,Map<Integer, List<DeepFishingBeachCombConfig>> beachCombConfig
            ,Map<String, ActivityConfig> configMap) {
        this.fishConfigMap = fishConfigMap;
        this.equipConfigMap = equipConfigMap;
        this.eventConfigMap = eventConfigMap;
        this.beachCombConfig = beachCombConfig;
        scoreItemId = configMap.get("EXCHANGE_SCORE_ITEM_ID").getIntValue();
        beachCombPowerItemId = configMap.get("SEAFISHING_GANHAI_ITEM_ID").getIntValue();
        fishingItemToScoreNum =configMap.get("SEAFISHING_ENERGY_SCORE_NUM").getIntValue();
        fishingPowerItemId = configMap.get("SEAFISHING_ENERGY_ITEM_ID").getIntValue();
        fishingPowerMax = configMap.get("SEAFISHING_ENERGY_MAX_NUM").getIntValue();
        fishingPowerPerTime = configMap.get("SEAFISHING_ENERGY_RECOVERY_NUM").getIntValue();
        fishPowerRecoveryTime =configMap.get("SEAFISHING_ENERGY_RECOVERY_TIME").getIntValue();
        dayFreeBeachCombTime = configMap.get("SEAFISHING_GANHAI_DAY_NUM").getIntValue();
        fishingDownSpeed = configMap.get("SEAFISHING_FISHING_SPEED_DOWN").getIntValue();
        fishingMoveSpeed = configMap.get("SEAFISHING_FISHING_SPEED_BEGIN").getIntValue();
        upDirectionSpeedCut = configMap.get("SEAFISHING_FISHING_SPEED_UP_CUT").getIntValue();
        mapMaxDeep =configMap.get("SEAFISHING_FISHING_MAP_LONG").getIntValue();
        coinItemId =configMap.get("SEAFISHING_COIN_ITEM_ID").getIntValue();
        autoRodLevelNeed = configMap.get("SEAFISHING_FISHING_QUICK_UNLOCK").getIntValue();
        firstBeachItem = configMap.get("SEAFISHING_GANHAI_FIRST_REWARD").getIntValue();
//        noCheckMeter = configMap.get("SEAFISHING_FISHING_PROTECT_1").getIntValue();
        speecCheckAdd = configMap.get("SEAFISHING_FISHING_PROTECT_2").getIntValue();

        List<DeepFishingObjectOcurRangeConfig> tmpOcurConfigList = new ArrayList<>();
        String seafishing_fishing_map_object_num = configMap.get("SEAFISHING_FISHING_MAP_OBJECT_NUM").getValue();
        List<String> stringList = StringUtils.stringToStringList(seafishing_fishing_map_object_num, "\\|");
        for (String string:stringList){
            List<Integer> list = StringUtils.stringToIntegerList(string, ";");
            if (list.size()!=3){
                continue;
            }
            DeepFishingObjectOcurRangeConfig ocurRangeConfig = new DeepFishingObjectOcurRangeConfig(list.get(0),list.get(1),list.get(2));
            tmpOcurConfigList.add(ocurRangeConfig);
        }
        tmpOcurConfigList.sort(Comparator.comparing((DeepFishingObjectOcurRangeConfig::getMinDeep)));
        ocurRangeConfigs = tmpOcurConfigList;

        objectSpace = configMap.get("SEAFISHING_FISHING_MAP_OBJECT_SPACE").getIntValue();
        List<Integer> intListValue = configMap.get("SEAFISHING_GANHAI_OPEN_TIME").getIntListValue("\\|");
        beachCombStartTime = intListValue.get(0);
        beachCombEndTime = intListValue.get(1);

        beachCombReflashCd = configMap.get("SEAFISHING_GANHAI_FLASH_CD").getIntValue();
        beachCombMaxItemInMap = configMap.get("SEAFISHING_GANHAI_OBJ_MAX_NUM").getIntValue();

        List<Integer> seafishing_ganhai_high_limit = configMap.get("SEAFISHING_GANHAI_HIGH_LIMIT").getIntListValue("\\|");
        minBeachCombHighQualityNum = seafishing_ganhai_high_limit.get(0);
        maxBeachCombHighQualityNum = seafishing_ganhai_high_limit.get(1);
        highQualityGoodThan = seafishing_ganhai_high_limit.get(2);

    }

    public Map<Integer, DeepFishingFishConfig> getFishConfigMap() {
        return fishConfigMap;
    }

    public Map<Integer, DeepFishingEquipConfig> getEquipConfigMap() {
        return equipConfigMap;
    }

    public Map<Integer, DeepFishingEventConfig> getEventConfigMap() {
        return eventConfigMap;
    }

    public Map<Integer, List<DeepFishingBeachCombConfig>> getBeachCombConfig() {
        return beachCombConfig;
    }

    public int getScoreItemId() {
        return scoreItemId;
    }

    public int getBeachCombPowerItemId() {
        return beachCombPowerItemId;
    }

    public int getFishingItemToScoreNum() {
        return fishingItemToScoreNum;
    }

    public int getFishingPowerItemId() {
        return fishingPowerItemId;
    }

    public int getFishingPowerMax() {
        return fishingPowerMax;
    }

    public int getFishingPowerPerTime() {
        return fishingPowerPerTime;
    }

    public int getFishPowerRecoveryTime() {
        return fishPowerRecoveryTime;
    }

    public int getDayFreeBeachCombTime() {
        return dayFreeBeachCombTime;
    }

    public int getFishingDownSpeed() {
        return fishingDownSpeed;
    }

    public int getFishingMoveSpeed() {
        return fishingMoveSpeed;
    }

    public int getUpDirectionSpeedCut() {
        return upDirectionSpeedCut;
    }

    public int getMapMaxDeep() {
        return mapMaxDeep;
    }

    public int getObjectSpace() {
        return objectSpace;
    }

    public List<DeepFishingObjectOcurRangeConfig> getOcurRangeConfigs() {
        return ocurRangeConfigs;
    }

    public int getBeachCombStartTime() {
        return beachCombStartTime;
    }

    public int getBeachCombEndTime() {
        return beachCombEndTime;
    }

    public int getBeachCombReflashCd() {
        return beachCombReflashCd;
    }

    public int getBeachCombMaxItemInMap() {
        return beachCombMaxItemInMap;
    }

    public int getMinBeachCombHighQualityNum() {
        return minBeachCombHighQualityNum;
    }

    public int getMaxBeachCombHighQualityNum() {
        return maxBeachCombHighQualityNum;
    }

    public int getHighQualityGoodThan() {
        return highQualityGoodThan;
    }

    public int getCoinItemId() {
        return coinItemId;
    }

    public int getAutoRodLevelNeed() {
        return autoRodLevelNeed;
    }

    public int getFirstBeachItem() {
        return firstBeachItem;
    }

    public int getNoCheckMeter() {
        return noCheckMeter;
    }

    public void setNoCheckMeter(int noCheckMeter) {
        this.noCheckMeter = noCheckMeter;
    }

    public int getSpeecCheckAdd() {
        return speecCheckAdd;
    }

    public void setSpeecCheckAdd(int speecCheckAdd) {
        this.speecCheckAdd = speecCheckAdd;
    }
}
